home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Sample Code / Newton Sample Code 1.2 / Views / Scroll Over-2 / README.Scroll Over next >
Encoding:
Text File  |  1993-08-12  |  2.0 KB  |  47 lines  |  [TEXT/R*ch]

  1. Scroll Over        by Bob Ebert
  2.  
  3. Demonstrates scrolling of views (clPictureViews in this case) using two methods.
  4.  
  5.  
  6. Method one uses a custom scrolling control which calls SetOrigin() on a clipping
  7. view to move the contents of the view around.  The clipping window also has a
  8. viewClickScript which tracks the pen and scrolls the contents as the user drags.
  9. (The view method :Drag() isn’t equipped to do this.)
  10.  
  11. The dragging is interesting and perhaps useful, as long as you don’t need to click
  12. on the scrolled contents or write over them.  It’s also non-intuitive, and should
  13. only be used in conjunction with a scroller control.
  14.  
  15. The scroller control itself has several things hardcoded that might better be
  16. gotten dynamically.  It was not intended as a generic scrolling utility, but
  17. rather an example to illustrate how to do local scrolling of a view.
  18.  
  19. In the sample, the scroller control bitmap for the top window comes from a
  20. resource file.  This image is available in the system rom, and could be gotten
  21. at runtime via ROM_canonicalCompass.icon.  (This won’t evaluate at compile time!)
  22. I chose to stick with a resource so that the controll image could be swapped.
  23.  
  24.  
  25. Method two uses the proto that the Newton electronic book reader has provided
  26. to do all the work.  This is handy, because you have to do almost nothing to
  27. make a view scroll.  With this method, you need to do the following:
  28.  
  29.     set the scrolledView slot in the canonicalCompass control to the view
  30.         to be scrolled.
  31.     make sure the view to be scrolled has the following slots:
  32.         dataBounds (a viewBounds slot which controls scrolling limits)
  33.         viewOriginX
  34.         viewOriginY
  35.         
  36. In the sample code, all these are done within the viewSetupDoneScript of the
  37. picture view which is scrolled.
  38.  
  39. This is probably the preferred method, since it’s so lightweight in RAM and
  40. programming requirements, plus it guarantees a consistent user interface.
  41.  
  42.  
  43. Note that the top example will scroll diagonally using the scroller controll,
  44. while the bottom one (using the book proto) doesn’t.  <shrug>
  45.  
  46.                         --Bob
  47.